# -*- coding:utf-8 -*-
__author__ = 'renyuan'
'''
测试DSP配置远程调用的client
'''

import sys
import Ice
Ice.loadSlice('LesComposer.ice')
import LESComposer
import imagedata
from pprint import pprint


class Client(Ice.Application):

    def run(self, args):
        if len(args) > 1:
            print('{0}: too many arguments'.format(self.appName()))
            return -1

        #获得DSPConfigService代理
        dsp_config_prx = LESComposer.DSPConfigServicePrx.checkedCast(
            self.communicator().propertyToProxy('DSPConfigService.Proxy'))
        if not dsp_config_prx:
            print('Invalid dsp_config_prx')
            return -1

        #构建测试数据
        test_seq_image = imagedata.Image_info_data()
        test_seq_image_info = test_seq_image.get_seq_image_info()
        #远程调用获取DSP配置
        test_dsp_name =  dsp_config_prx.getDSPStrategy()
        print('test dsp config name', test_dsp_name)
        test_return_value = (dsp_config_prx.getDSPConfig(test_seq_image_info, 'image_color_enhance'))[1]
        pprint(test_return_value)

        return 1


app = Client()
sys.exit(app.main(sys.argv, 'config.client'))
